<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=cp-1251">
<title>ACSystem</title>
<?php
$ci = &get_instance(); 
$ci->load->helper('url'); ?>
<script src=" <?php echo base_url()."jscripts/jquery-1.5.min.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/equalHeight.js";?> " type="text/javascript" ></script>


<script src=" <?php echo base_url()."jscripts/coda-slider.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jquery.localscroll-1.2.5.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jquery-1.2.6.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jquery.scrollto-1.3.3.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jquery.serialscroll-1.2.1.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jey_script.js";?> " type="text/javascript" ></script>
<script src=" <?php echo base_url()."jscripts/jquery.maskedinput-1.2.2.min.js";?> " type="text/javascript" ></script>
<link href="<?echo base_url();?>css/main_view.css" rel="stylesheet" type="text/css" />
<link href="<?echo base_url();?>css/ware.css" rel="stylesheet" type="text/css" />

</head>

<body>
<div id="carrier">
    <?
	include("application/views/blocks/login_menu.php");
	include("application/views/blocks/header.php");
	include("application/views/blocks/main_menu.php");
	?>
    <div id="content">
		<div id="show_products">
        <p class="center"><a href="#product_slider" class="info" id="head_slider">Show available products</a></p>
		</div>
        <div id="product_slider">
            
            <p class="question">Products, which are available:</p>
        
            <?php 
                echo "<table id='slider_table'>";
                echo "<tr>";
                echo "<th><strong>Product name</strong></th>";
                echo "<th><strong>Short info</strong></th>";
                echo "</tr>";
                
                $count_products=count($products);
                
                
                
                for($i=0;$i<$count_products;$i++)
                {
                   echo "<tr>";
                    echo "<td class='left_align'>".$products[$i]['Name']."</td>";
                    echo "<td class='left_align'>".$products[$i]['ShortInfo']."</td>";
                    echo "</tr>";    
                }
                
                echo "</table>"                        
            ?>
        </div>
        
        
        
        
        <div id="table">
        <?php
                
                $trap = false;
                $automat_id = $this->session->userdata('automat_id');
                $count = count($wares);
                
                for($i=0;$i<$count;$i++)
                {
                    if ($wares[$i]['AutomatId'] == $automat_id)
                    {
                        $trap = true;
                        break;
                    }   
                }
                if ($trap)
                {
                
                echo "<p class = 'question'>Wares, which are available for sell:</p>";
                
                echo '<table id="ware_table">';
                echo "<tr>";
                echo "<th><strong>Product name</strong></th>";
                echo "<th><strong>Price</strong></th>";
                echo "<th><strong>Amount</strong></th>";
                echo "<th><strong>Sell from (hour)</strong></th>";
                echo "<th><strong>Sell to (hour)</strong></th>";
                echo "<th><strong>If can sell</strong></th>";
                echo "<th><strong>Short information</strong></th>";
                echo "</tr>";
              
                
                $cnt=count($wares);
                $color_raw = false;
                for($i=0;$i<$cnt;$i++)
                {
                    if ($wares[$i]['AutomatId'] == $automat_id)
                    {
                        $name = $this->Waremodel->productName($wares[$i]['ProductCode']);
                        $short_info = $this->Waremodel->short_info($wares[$i]['ProductCode']);
                        $can_sell;
                        if ($wares[$i]['CanSell'] == true)
                            $can_sell = "can sell";
                        else
                            $can_sell = "cannot cell";
                        
                        if ($color_raw == true){
                            $color_raw = !$color_raw;
                            echo "<tr class='blue'>";
                        }
                        else{
                            echo "<tr class='yellow'>";
                            $color_raw = !$color_raw;
                        }
                        
                        
                        echo "<td>$name</td>";
                        echo "<td>".$wares[$i]['Price']."</td>";
                        echo "<td>".$wares[$i]['Amount']."</td>";
                        echo "<td>".$wares[$i]['SellFrom']."</td>";
                        echo "<td>".$wares[$i]['SellTo']."</td>";
                        echo "<td>".$can_sell."</td>";
                        echo "<td>".$short_info."</td>";
                        echo "</tr>";
                    }
                }
                

                
                echo "</table>";
                }
                else
                    echo "<p class = 'question'>There are no available wares for sell!</p>";
            ?>
        </div>
        
        <div id="wrapper">
        <div id="slider">    
            <ul class="navigation">
                <li><a class="" href="#add_ware">Add ware</a></li>
                <li><a class="selected" href="#delete_ware">Delete ware</a></li>
                <li><a class="" href="#can_sell_ware">Can sell ware</a></li>
                <li><a class="" href="#update_ware">Update ware</a></li>
                
                
            </ul>

            

            
            
            <div style="overflow: hidden;" class="scroll">
                <div style="width: 4340px;" class="scrollContainer">
                    <div style="float: left; position: relative;" class="panel" id="add_ware">
                        
                        
                        <fieldset>
                            <legend>Add ware</legend>
                                <form action="ware/add_ware" method="post">
                                    <label for="name" class="question">Please, enter name of ware:</label>
                                    <p><input value="<?php set_value('name') ?>" class="input" name="name" id="name" type="text"/><strong><?php form_error('name')?></strong></p>
                                    
                                    <label for="price">Price:</label>
                                    <p><input class="input" name="price" id="price" type="text"/></p>
                                    
                                    <label for="amount">Amount:</label>
                                    <p><input class="input" name="amount" id="amount" type="text"/></p>
                                    
                                    <label for="sell_from">Sell from(ex. 10:00:00):</label>
                                    <p><input class="input" name="sell_from" id="sell_from" type="text"/></p>
                                    
                                    <label for="sell_to">Sell to(ex. 22:00:00):</label>
                                    <p><input class="input" name="sell_to" id="sell_to" type="text"/></p>
                                    
                                    <label for="can_sell">If can sell(ex. 1/0):</label>
                                    <p><input class="input" name="can_sell" id="can_sell" type="text"/></p>
                                    
                                    <p><input value="OK" type="submit"/></p>
                            
                            </form>
                        </fieldset>
                    </div>
                    
                    <div style="float: left; position: relative;" class="panel" id="delete_ware">
                        <fieldset>
							<legend>Delete ware</legend>
                            <form action="ware/delete_ware" method="post">
                                <label for="name" class="question">Please, enter name of ware, you would like to delete:</label>
                                <p><input class="input" name="name" id="name" type="text"/></p>	
                                <p><input value="OK" type="submit"/></p>
                            </form>
							
						</fieldset>
                        
                    </div>
                    
                    
                    <div style="float: left; position: relative;" class="panel" id="can_sell_ware">
                        <fieldset>
							<legend>Can sell ware</legend>
                            <form action="ware/can_sell_ware" method="post">
                                <label for="name" class="question">Please, enter name of ware, you would like to change sell option:</label>
                                <p><input class="input" name="name" id="name" type="text"/></p>	
                                
                                <label for="can_sell">If can sell(ex. 1/0):</label>
                                <p><input class="input" name="can_sell" id="can_sell" type="text"/></p>
                                
                                <p><input value="OK" type="submit"/></p>
                            </form>
							
						</fieldset>
                        
                    </div>
                    
                    
                    
                    
                    <div style="float: left; position: relative;" class="panel" id="update_ware">
                        <fieldset>
                            <legend>Update ware</legend>
                                <form action="ware/update_ware" method="post">
                                    <label for="name" class="question">Please, enter name of ware, you would like to update:</label>
                                    <p><input class="input" name="name" id="name" type="text"/></p>
                                    
                                    <label for="price">Price:</label>
                                    <p><input class="input" name="price" id="price" type="text"/></p>
                                    
                                    <label for="amount">Amount:</label>
                                    <p><input class="input" name="amount" id="amount" type="text"/></p>
                                    
                                    <label for="sell_from">Sell from(ex. 10:00:00):</label>
                                    <p><input class="input" name="sell_from" id="sell_from2" type="text"/></p>
                                    
                                    <label for="sell_to">Sell to(ex. 22:00:00):</label>
                                    <p><input class="input" name="sell_to" id="sell_to2" type="text"/></p>
                                    
                                    <p><input value="OK" type="submit"/></p>
                            
                            </form>
                        </fieldset>
                    </div>
                    
                    
                
                <script type="text/javascript">
                jQuery (function($){
                    $.mask.definitions['H']='[012]';
                    $.mask.definitions['M']='[012345]';
                    $('#sell_from').mask('HM:M9');
                    $('#sell_to').mask('HM:M9');
                    
                });
                </script>
                
                
                </div>
            </div>
            
            
                        
            
            <div id="shade"></div>
        </div>

        
        
    </div>
        

    
    </div>
    <div class="clear"></div>
    <?
	include("blocks/footer.php");
	?>
</div>
</body>
</html>




